home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7355 < prev    next >
Encoding:
Text File  |  1996-08-05  |  942 b   |  30 lines

  1. Path: newsfeed.direct.ca!usenet
  2. From: etoivane@direct.ca (Ed Toivanen)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to check array lenght?
  5. Date: 25 Feb 1996 21:50:45 GMT
  6. Organization: Your Organization
  7. Message-ID: <4gqljl$jno@aphex.direct.ca>
  8. References: <4gbphl$ht@malakor.kku.ac.th> <Pine.A32.3.91.960221002504.156335H-100000@black.weeg.uiowa.edu> <4ggmfs$tg@dopey.magg.net>
  9. NNTP-Posting-Host: 204.174.243.150
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14. In article <4ggmfs$tg@dopey.magg.net>, n4mwd@magg.net says...
  15.  
  16. >Try using: 
  17. >
  18. >#define numelem(array)   (sizeof(array) / sizeof(array[0]))
  19. >
  20. >then pass the results as an extra parameter to your function.
  21.  
  22. sizeof(array) is the pointer size, not the size of the array in bytes, and 
  23. sizeof(array[0]) is the size of the 0th element.  Not exactly what you 
  24. intended.  You have to keep track of the array size, then pass it as a 
  25. parameter.
  26.  
  27. Ed
  28.  
  29.  
  30.